<?php
//管理员登录
    header("Access-Control-Allow-Origin: *"); // 允许跨域的地址，* 表示全部
    header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS"); // 允许的请求方法
    header("Access-Control-Allow-Headers: version, access-token, user-token"); // 允许的请求头属性

include_once '../util/connect.php';

$Phone = $_POST['Phone'];
$Pwd = $_POST['AdminPassword'];

$Pwd1 = $Pwd.'0xz765nb';//加盐拼接
    
//加密后密码,加盐0xz765nb
$AdminPassword =md5($Pwd1);

$sql = "select * from admin where Phone='$Phone' and AdminPassword='$AdminPassword' and Status = '0' ";
$data = my_Select($sql);

if(count($data) > 0 ){
    if (!session_id()) session_start();
    $_SESSION['adminInfo'] = $data[0];
    $arr = [
        "status" => 0,
        "message" => "登陆成功"
    ];
}else{
    $arr = [
        "status" => 1,
        "message" => "登陆失败"
    ];
}


echo json_encode($arr,JSON_UNESCAPED_UNICODE);
